<%@ page contentType="text/html; charset=utf-8"%>
<%@ include file="../../../common/include.jsp"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
	<head>
<jsp:include page="../../../common/head.jsp">
	<jsp:param name="_useUpload" value="true"/>
</jsp:include>
<script language="javascript">
	var saveState = false;
	function saveinfo()
	{
		xj.extArrayAllowed = new Array('.xls','.jasper');
		if(saveState==true)
		{
			var objarr = new Array(
				["reportId","报表编号","notEmpty",""],
				["reportId","报表编号","max","String:50"],
				["reportName","报表名称","notEmpty",""],
				["reportName","报表名称","max","String:50"]
			);
		
			if(xj.CheckAll(objarr))
			{
				if(confirm("确认复制？"))
				{
					return true;
				}
			}
		}
		return false;
	}
	function checkReportId()
	{
		var tmp = parseInt(Math.random()*10000+1);//设定随机数防止浏览器以相同url重复多次访问不进行请求
		var url = 'checkExistsReportEngine.do?reportId='+$("#reportId").val()+"&tmp="+tmp;
		$.get(url, {},function (data, textStatus){
			if(data=="ok")
			{
				saveState = true;
			}
			else
			{
				xj.showNoticeDiv(document.getElementById("reportId"),"报表编码已存在，请重新设置！",true);
			}
		});
		saveState = false;
	}
	//返回
	function goback()
	{
		window.top.close();
	}

</script>

<title>添加报表模板</title>
</head>
<body>
<form action="saveCopyReportEngine.do" method="post" name="form1" onsubmit="return saveinfo()">
<input type="hidden" name="reportId_old" value="${param.reportId}"/>
<div id="body_div">
	<w:ShowTitle name="复制报表模板">
	<w:TitleButton funcName="保存" onClickFunction="" urlImg="${ctx}/images/main/save.png" funcType="submit"/>
	<w:TitleButton funcName="返回" onClickFunction="goback()" urlImg="${ctx}/images/main/back.png"/>
	</w:ShowTitle>
	<div id="body_content">
  <table width="100%">
    <tr>
	   <td>模板编号</td>
	   <td class="left_align"><input type="text" name="reportId" id="reportId" onblur="checkReportId()"/></td>
    </tr>
    <tr>
	   <td>模板名称</td>
	   <td class="left_align"><input type="text" name="reportName"/></td>
    </tr>
</table>
</div>
</div>
</form>
</body>
</html>
